package com.sise.controller;

import com.sise.bean.CodeMsg;
import com.sise.service.IToDoService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zj
 */
@RestController
@RequestMapping("/sise/to-do")
public class ToDoController {

    @Resource
    private IToDoService toDoService;

    @RequestMapping("/getTODO")
    public CodeMsg getTODO() {
        return toDoService.getTODO();
    }

    @PostMapping("/addTODO")
    public CodeMsg addTODO(String content) {
        return toDoService.addTODO(content);
    }

    @PostMapping("/deleteTODO")
    public CodeMsg deleteTODO(Integer id) {
        return toDoService.deleteTODO(id);
    }

    @PostMapping("/updateTODOContent")
    public CodeMsg updateTODOContent(Integer id, String content) {
        return toDoService.updateTODOContent(id, content);
    }

    @PostMapping("/completeTODO")
    public CodeMsg completeTODO(Integer[] ids) {
        return toDoService.completeTODO(ids);
    }
}
